<template>
	<view class="apps">
		<view id="wwlogin" style="height: 480px; width: 416px; margin: 0 auto;"></view>
	</view>
</template>

<script>
	let app;
	import * as ww from '@wecom/jssdk'
	export default {
		data() {
			return {
				
			}
		},
		onLoad() {
			app = this;
			
		},
		onReady() {
			if(!uni.getStorageSync('WeApp_token')){
				const wwLogin = ww.createWWLoginPanel({
				  el:"#wwlogin",
				  params: {
				    login_type: 'CorpApp',
				    appid: 'ww5d7b19c3c1ce8e1f',
				    agentid: '1000007',
				    redirect_uri: 'https://wework.sdlycwzx.com',
				    state: 'wwlogin',
				    redirect_type: 'callback',
					panel_size:'middle',
				  },
				  onLoginSuccess({ code }) {
				    console.log('Code:', code);
				  },
				  onLoginFail(err) {
				    console.log('err:', err);
				  },
				})
				console.log(ww);
				console.log(wwLogin);
			}else{
				let url = uni.getStorageSync('notice_url')||'/pages/index/index';
				uni.navigateTo({
					url:url,
				})
			}
		},
		methods: {
		}
	}
</script>
